package com.mytx.search.config;


import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.action.update.UpdateResponse;

/**
 * <p>搜索相关接口</p>
 *
 */
public interface SearchClient {

    /**
     * 搜索结果
     */
    SearchResponse search(SearchRequest request);

    /**
     * 搜索
     */
//    <T> List<T> search(SearchRequest request, Class<T> tClass);

    /**
     * 索引（保存）数据
     * @param request
     * @return
     */
    IndexResponse index(IndexRequest request);

    /**
     * 获取数据
     * @param request
     * @return
     */
    GetResponse get(GetRequest request);

    /**
     * 更新数据
     * @param request
     * @return
     */
    UpdateResponse update(UpdateRequest request);

    /**
     * 删除数据
     * @param request
     * @return
     */
    DeleteResponse delete(DeleteRequest request);

    /**
     * 批量处理
     * @param request
     * @return
     */
    BulkResponse bulk(BulkRequest request);

}
